package com.symbio.ishenapi.background.controller;

import com.symbio.ishenapi.background.model.TmBusinesscardApply;
import com.symbio.ishenapi.common.controller.BaseController;
import io.jboot.web.controller.annotation.RequestMapping;

import java.math.BigInteger;
import java.util.Date;
@RequestMapping("/TmBusinesscardApply")
public class TmBusinesscardApplyController extends BaseController {

    public void saveTmBusinesscardApply(){      //名片申请
        TmBusinesscardApply apply = (TmBusinesscardApply)getReqBodyObject(TmBusinesscardApply.class);
        apply.setCreateTime(new Date());
        //apply.save();
        if (apply.save())
            renderJsonRet(40001);
        else
            renderJsonError(40002,"成功");
    }

    public void findDoctorUser() {      //查看名片申请
        BigInteger id = new BigInteger(getPara("id"), 10);
        TmBusinesscardApply item = TmBusinesscardApply.dao.findById(id);
        if (item == null) {
            renderJsonError(40003);
            return;
        }
        renderJsonRet(item);
    }

    public void findAll(){      //查看全部申请
        TmBusinesscardApply apply = (TmBusinesscardApply)getReqBodyObject(TmBusinesscardApply.class);
        renderJson(TmBusinesscardApply.dao.findAll(apply));
    }

}
